<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>jquery_resource_understander_study</title>
</head>
<body>
<script type="text/javascript">

    /**
     * jquery函数
     * @param selector
     * @param context
     * @returns {aQuery.init}
     */
    var aQuery = function(selector, context) {
        return  new aQuery.prototype.init();
    };


    /**
     * jquery函数的prototype
     * @type {{init: aQuery.init, name: aQuery.name, age: number}}
     */
    aQuery.fn = aQuery.prototype = {

        /**
         * init
         * @returns {aQuery}
         */
        init: function() {
            return this;
        },

        name: function() {
            return this.age
        },

        age: 20,


    };



    //本身和原型上面都添加一个extend方法
    aQuery.fn.extend = aQuery.extend  = function() {};

    /**
     * init的prototype又装着aQuery的prototype和aQuery.fn
     * @type {*}
     */
    aQuery.prototype.init.prototype = aQuery.prototype;


    console.log(aQuery().name()) //20



</script>

</body>
</html>